<%@page contentType="text/html;charset=UTF-8"%>
<%@include file="/common/taglibs.jsp"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<script type="text/javascript">
	$(document).ready(function() {
		$("#inputForm").validate({
			event : "blur",
			isTip : true
		});
		kl();
		});
	function ouk(id){
		var s = $("#d"+id).val();
		if(s==0){
			$("#d"+id).val("");
		}
	}
	function jisuan(id){
		var d = $("#d"+id).val();
		var s = $("#s"+id).html();
		var sd = d*s;
		$("#sd"+id).html(sd);
		kl();
	}
	function kl(){
		var sum = 0;
		var count = $("#true").val();
		for(var i = 1 ; i<=count;i++){
			var a1 = $("#sd"+i).html();
			if(a1){
				sum = sum + parseInt(a1);
			}
		}
		$("#sum").html(sum);
	}
	function kk(){
		location.href = "${ctx}/contract/itemlist.action?cid=${cid}&decorator=${decorator}&confirm=${confirm}"
	}
</script>
<title>费用合计</title>
</head>
<body>
<form action="${ctx }/contract/inventor!update.action?decorator=${decorator}&confirm=${confirm}" method="post" class="yform" id="inputForm">
<input name="cid" type="hidden" value="${param.cid }">
<div id="content">
<table class="contentTable">
	<c:set var="flag" scope="page"></c:set>
	<c:forEach items="${inventorList}" var="inventor" varStatus="pp">
	<c:if test="${flag!=inventor.branchCode }">
		<c:set var="flag" scope="page">${inventor.branchCode }</c:set>
		<tr>
		<td>检测项目名称<font color="red">(${inventor.branchName })</font></td>
		<td style="width: 80px" align="center">计量</td>
		<td style="width: 180px" align="center">单价</td>
		<td style="width: 150px" align="center">金额</td>
	</tr>
	</c:if>
	<c:if test="${flag==inventor.branchCode }">
	<tr>
		<td>${inventor.checkName }</td>
		<td align="center">
		<input type="hidden" name="acc[${pp.count}].value" value="${inventor.id}">
		<input type="text"  name="acc[${pp.count}].label" id="d${pp.count}"
		class="required number"
		value="${inventor.measure }" style="width: 80px" 
		onfocus="ouk('${pp.count}');" onblur="jisuan('${pp.count}');"></td>
		
		<td align="center"><span id="s${pp.count}">${inventor.unitPrice }</span>
		/${inventor.units }</td>		
		
		<td align="center">
		<font color="red"><span id="sd${pp.count}">
		${inventor.measure * inventor.unitPrice }</span></font>
		<input type="hidden" id="${pp.last}" value="${pp.count}">
		</td>
	</tr>
	</c:if>
	</c:forEach>
	<tr><td colspan="3" align="center">合   计</td>
		<td style="width: 150px" align="center"><font color="red"><span id="sum"></span></font></td></tr>
</table>
</div>
<div class="type-button">
<input type="button" value="上一步" onclick="kk();">
<input type="submit" value="下一步" >
	
</div>
</form>
</body>
</html>